package com.cww.study.biz;

import com.cww.study.mybatis.PageResultBean;
import com.cww.study.po.News;
import com.cww.study.service.NewsService;
import com.cww.study.vo.QueryNewsPageListVO;
import com.cww.study.vo.SaveNewsVO;
import com.cww.study.vo.UpdateStateVO;
import com.cww.study.vo.UpdateUserStateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @program: cww_project
 * @description:
 * @author: 陈英俊
 * @create: 2022-03-08 13:56
 */
@RestController
@RequestMapping("/news")
@Api(tags = "新闻")
public class NewsBiz {


    @Resource
    private NewsService newsService;

    @ApiOperation(value = "新增/编辑")
    @PostMapping("/save")
    @CrossOrigin
    public void save(SaveNewsVO vo) {
        newsService.save(vo);
    }


    @ApiOperation(value = "删除/禁用")
    @PostMapping("/updateState")
    @CrossOrigin
    public void updateState(UpdateStateVO vo) {
        newsService.updateState(vo);
    }

    @ApiOperation(value = "列表查询")
    @PostMapping("/queryNewsPageList")
    @CrossOrigin
    public PageResultBean<News> queryNewsPageList(QueryNewsPageListVO vo) {
        return newsService.queryPageList(vo);
    }

    @ApiOperation(value = "查询详情/回显")
    @PostMapping("/getDetailById")
    @CrossOrigin
    public News getDetailById(String id) {
        return newsService.getDetailById(id);
    }

}
